SET(SQ_ALL_SRCS CACHE INTERNAL "All source files" FORCE)

ADD_SUBDIRECTORY(c)

IF(SQ_BUILD_SHARED_LIBRARIES)
  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/c/include)

  INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/generated)
  
  ADD_LIBRARY(SequantoAutomation_SHARED SHARED ${SQ_ALL_SRCS})
  
  SET_SOURCE_FILES_PROPERTIES(${SQ_ALL_SRCS} PROPERTIES COMPILE_FLAGS
    "-DSQ_SEQUANTO_AUTOMATION_SHARED -DSQ_SEQUANTO_AUTOMATION_SOURCE")
  
  IF(WIN32)
    IF(NOT SQ_QT_MACHINE_AUTOMATION)
      TARGET_LINK_LIBRARIES(SequantoAutomation_SHARED WS2_32)
    ENDIF(NOT SQ_QT_MACHINE_AUTOMATION)
  ENDIF(WIN32)

  IF(SQ_INSTALL_BINARY)
    INSTALL(TARGETS SequantoAutomation_SHARED
      RUNTIME DESTINATION bin
      LIBRARY DESTINATION lib
      ARCHIVE DESTINATION lib)
  ENDIF(SQ_INSTALL_BINARY)
ENDIF(SQ_BUILD_SHARED_LIBRARIES)
